package com.mytrip.webapp.filter;

import com.mytrip.model.BackendAccessLog;
import com.mytrip.webapp.session.SessionBagImpl;

/**
 * 在每次请求中用来暂存 application bag 和 sesson bag
 * 
 * @author evan
 * @version 0.1, 2008-3-9
 * @since   JDK1.6
 */
public class CtxSessionBag {
	private static final ThreadLocal<SessionBagImpl> sessionBagThread = new ThreadLocal<SessionBagImpl>();
	private static final ThreadLocal<BackendAccessLog> backendAccessLogThread = new ThreadLocal<BackendAccessLog>();
	
    public static SessionBagImpl getSessionBag() {
        return sessionBagThread.get();
    }

    public static void setSessionBag(SessionBagImpl s){
    	sessionBagThread.set(s);
    }
    
    public static BackendAccessLog getBackendAccessLog(){
    	return backendAccessLogThread.get();
    }
    
    public static void setBackendAccessLog(BackendAccessLog b){
    	backendAccessLogThread.set(b);
    }
    
    public static void clear(){
    	sessionBagThread.set(null);
    	backendAccessLogThread.set(null);
    }
}
